<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <a name="link" id="home" href="home">home</a>
    <a name="link" href="contract">contract</a>
    <a name="link" href="movie">movie</a>
    <script>
        // getElementsByName 按name属性获取元素，返回多个对象（数组）
        var obj1 = document.getElementsByName("link");
        // getElementsByName 按标签名称获取元素，返回多个对象（数组）
        var obj2 = document.getElementsByTagName("a");
        // getElementsByName 按ID属性获取元素，返回单个对象
        var obj3 = document.getElementById("home");
        console.log(obj1[0]);
        console.log(obj2[0]);
        console.log(obj3);
    </script>
    </script>
</body>
</html>